import {mockBrandData,mockSeleSku, reqGetSkuById } from '@/api'

const state = {
    skuList: {},
   
}

const mutations = {
    // 获取所有信息
    GETSKUDATA(state, data) {
        state.skuList = data
    },
}

const actions = {
    // 获取sku信息
    async getSkuData({ commit},{ limit, page }) {
        const results = await mockBrandData(limit, page)
        // console.log(results);
        if (results.status == 200) {
            commit('GETSKUDATA',results.data)
         }
    },
    // 查询sku信息
    async seleSku({ commit }, keyword) {
        const results = await mockSeleSku(keyword)
        console.log('查询:', results);
        if (results.status == 200) {
            const data = {
                result: results.data.data,
                total:results.total
            }
             commit('GETSKUDATA',data)
         }
    },
}

const getters ={}

export default {
    state,
    mutations,
    actions,
    getters
}